/*
 * @Author: Haochen
 * @Date: 2021-12-10 17:41:16
 * @LastEditTime: 2021-12-13 15:06:50
 * @FilePath: \students-system\src\store\modules\subjects.js
 */

import api from '@/api/api';

export default {
  namespaced: true,
  state: {
    rows: [],
    pages: 0,
    total: 0,
  },
  mutations: {
    SET_SUBJECTS(state, payload) {
      Object.assign(state, payload);
    },
  },
  actions: {
    async getSubjectsAsync(context, payload) {
      const { data: res } = await api.subjects.getSubjects(payload);
    
      if (res.code) {
        context.commit('SET_SUBJECTS', res.data);
      }
    },
  },
  getters: {},
};
